package top.lyc829.zzl_android.logic.database;

import android.content.Context;

import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;

import top.lyc829.zzl_android.logic.bean.NoticeCommentBean;
import top.lyc829.zzl_android.logic.bean.NoticeSystemBean;
import top.lyc829.zzl_android.logic.database.dao.NoticeCommentDao;
import top.lyc829.zzl_android.logic.database.dao.NoticeSystemDao;

@Database(entities = {NoticeSystemBean.class, NoticeCommentBean.class}, version = 2, exportSchema = false)
public abstract class MyDataBase extends RoomDatabase {

    private static MyDataBase INSTANCE;

    public synchronized static MyDataBase getInstance(Context context) {
        if (INSTANCE == null) {
            INSTANCE = Room.databaseBuilder(context.getApplicationContext(), MyDataBase.class, "zzl_database")
                    .allowMainThreadQueries()
                    .build();
        }
        return INSTANCE;
    }


    public abstract NoticeSystemDao getNoticeSystemDao();

    public abstract NoticeCommentDao getNoticeCommentDao();
}
